function loadcontent() {
	loadnews()
	loadmaterials()
}

function loadnews() {
	$.get('api/news_get.php?TOKEN=b7f61ef8e0d831455de0ee544809dfaa', function(data){
		let news = JSON.parse(data)['news']
		showNews(news)
	});
}

function loadmaterials() {
	$.get('api/materials_get.php?TOKEN=b7f61ef8e0d831455de0ee544809dfaa', function(data){
		let materials = JSON.parse(data)['materials']
		showMaterials(materials)
	});
}

function showNews(news) {
	let div = $('#news')
	for (let i = 0; i < news.length; i++) {
		let title = $('<h1>'+news[i].title + '</h1>')
		let content = $('<h2>'+news[i].content + '</h2>')
		let date = $('<h3>'+news[i].date + '</h3><br>')
		
		div.append(title)
		div.append(content)
		div.append(date)
		console.log(title)
	}
		console.log(news.length)
}

function showMaterials(materials) {
	let div = $('#materials')
	for (let i = 0; i < materials.length; i++) {
		let name = $('<h2>'+materials[i].name + '</h1>')
		let amount = $('<h3>Количество: '+materials[i].amount + '</h2>')
		let price = $('<h2>Цена: '+materials[i].price + '</h3><hr>')

		div.append(name)
		div.append(amount)
		div.append(price)
		console.log(name)
	}
		console.log(materials.length)
}